#include "testlogservice.h"

TestLogService::TestLogService()
{
}

void TestLogService::testExecute()
{
    QString log = "log";
    QByteArray result;

    {
        QByteArray block;
        QDataStream out(&block, QIODevice::WriteOnly);
        out << QString("LOG")  << log;
        LogService logService;
        QDataStream in(block);
        result = logService.execute(in);
    }

    QByteArray expected;

    {
        QDataStream out2(&expected, QIODevice::WriteOnly);
        out2 << quint16(0) << QString("OK") ;
        out2.device()->seek(0);
        out2 << quint16(expected.size() - sizeof(quint16));
    }

    QCOMPARE(result, expected);
}
